#include "testdemo.h"
#include <qpushbutton.h>
#include <qscreen.h>
#include <thread>
#include <chrono>

using namespace std::literals;

#pragma execution_character_set("utf-8")
testdemo::testdemo(QWidget *parent)
    : QMainWindow(parent)
{
    ui.setupUi(this);
    OnInitDialog();
}

testdemo::~testdemo()
{}

void testdemo::OnInitDialog()
{
    auto _btn = new QPushButton(tr("testdemo"), this);
    Q_ASSERT(_btn);
    auto _size = screen()->availableGeometry();
    _btn->move((_size.width() / 4 - 100) / 2, (_size.height() / 5 - 100) / 2);
    connect(_btn, &QPushButton::clicked, [] {
        int a[10]{};
        for (int i = 0; i < 15; ++i)
        {
            a[i] = i + 100;
            std::this_thread::sleep_for(std::chrono::milliseconds(1000));
        }
        });
}
